<?php
/**
 * 管理
*/
apf_require_class("Bll_BLL");
apf_require_class('Bll_Hr_OutInterface');
class Bll_Flow_User extends BLL {
    /**
     * 获取一条入职记录
     * @param int $uid
     */
    public function get_user_by_id($entry_id){
        $result = array();
        $entry_id = intval($entry_id);
        if(!$entry_id){
            return $result;
        }
        return  $this->_get_dao_flow_user()->find_by_id($entry_id);
    }
    /**
     * 获取多条
     */
    public function get_user_by_ids($entry_ids){
        $result = array();
        if(!is_array($entry_ids) || empty($entry_ids)){
            return $result;
        }
        return  $this->_get_dao_flow_user()->find_by_ids($entry_ids);
    }
   /**
     * 添加新员工
     * @param array $data
     * @return number
     */
    public function add_flow_user($data){
        unset($data['entry_id']);
        $data['last_update'] = date('Y-m-d H:i:s');
        return $this->_get_dao_flow_user()->insert($data);
    }
    /**
     * 更新员工
     * @param int $uid
     * @param array $data
     */
    public function update_flow_user($entry_id,$data){
        $entry_id = intval($entry_id);
        if(!$entry_id){
            return 0;
        }
        if(isset($data['entry_id'])){
            unset($data['entry_id']);
        }
        $data['last_update'] = date('Y-m-d H:i:s');
        $this->_get_dao_flow_user()->update_by_id($entry_id,$data);
        return 1;
    }
    /**
     * 同步数据到hroa
     * @param int $entry_id
     * @param array $data
     */
    public function from_entry_to_user($entry_id,$role,$hroa){
        apf_require_class('Const_BaseInfo');
        $entry_id = intval($entry_id);
        if(!$entry_id){
            return 0;
        }
        $entry = $this->get_user_by_id($entry_id);
        //hr操作
        if(isset($role['hr'])){
            //同步数据
            if(!$entry['user_id']){//insert
                $user_id = $this->_new_hroa_user_and_relation($entry,$hroa);
                //更新 user_id
                $this->_get_dao_flow_user()->update_by_id($entry_id,array('user_id'=>$user_id));
            }else{//update
                $this->_delete_hioa_user_and_relation($entry,$hroa);
            }
        }elseif(isset($role['xz']) || isset($role['it'])){
            //同步数据
            if($entry['user_id']){//update
                $data = $this->_build_entry_to_user($entry);
                $hroa->user_update($entry['user_id'],$data);
            }
        }else{//行政招聘直接取消
            //同步数据
            $user_id = $this->_new_hroa_user_and_relation($entry,$hroa);
            //更新 user_id
            $this->_get_dao_flow_user()->update_by_id($entry_id,array('user_id'=>$user_id));
        }
    }
    /**
     * 检测行政招聘，是否可以进入到编辑页
     * @param Bll_Flow_Info $bll_info
     * @param Bll_Flow_Log $bll_log
     */
    public function check_recruit_can_operate($bll_info,$bll_log,$entry){
        $flow = $bll_info->get_flow_by_uid($entry['entry_id']);
        $result = false;
        //正在执行，第一阶段，hr没有操作
        if($flow['flow_stage'] == Const_Flow::FLOW_ENTRY_1 && $flow['now_status'] == Const_Flow::FLOW_STATUS_DOING && !$entry['user_id']){
            $result = true;
        }
        return $result;
    }
    /**
     * 入职流程办理
     * @param array $role array('it','hr','xz','zp')
     * @param array $params array(entry_id，submit=1:确认入职|2：取消入职|3：提交办理)
     * @param array $data post entry data
     * @param int $operate_user_id 操作人id
     */
    public function operate_entry($role,$params,$data,$operate_user_id){
        //处理页面提交提交
        $this->_execute_submit($role,$params,$data);
        //记录到log
        $user = $this->get_user_by_id($params['entry_id']);//重取提交后的
        $this->_execute_log($role,$params,$user,$operate_user_id);
        //修改代办事项 到下一步
        $this->_execute_stage($role,$params,$user);
    }
    /**
     * 页面提交处理
     */
    private function _execute_submit($role,$params,$data){

        $this->update_flow_user($params['entry_id'], $data);
        //取消流程办理，提交，不需同步
        if(isset($role['qx_it']) || isset($role['qx_xz'])){
            return ;
        }
        //同步数据到hroa
        if(intval($params['submit']) == 3){
            unset($role['hr']);
        }else{
            if(intval($params['submit']) == 1){//确认入职
                //更新生效时间
                if(isset($data['re_entry_date'])){
                    $flow = $this->_get_flow_by_id($params['entry_id']);
                    $data_flow = array('effect_date'=>$data['re_entry_date']);
                    $this->_get_bll_flow_info()->update_flow_entry($flow['flow_id'],$data_flow);
                    //更新log的生效时间
                    $this->_get_bll_flow_log()->update_plan_date($flow['flow_id'],$data['re_entry_date']);
                }
            }
            unset($role['xz']);
            unset($role['it']);
        }
        $this->from_entry_to_user($params['entry_id'],$role,$this->_get_bll_hroa());
    }
    /**
     * 记录log
     */
    private function _execute_log($role,$params,$user,$operate_user_id){
        //flow
        $flow = $this->_get_flow_by_id($params['entry_id']);
        $basic = array(
                'flow_type'=>Const_Flow::FLOW_TYPE_ENTRY,//入职流程
                'user_id' =>$params['entry_id'],
                'opt_user_id'=>$operate_user_id,//操作人id
                'work_city_id'=>$user['work_city_id'],
                'flow_id'=>$flow['flow_id'],
                'operate_time'=>date('Y-m-d H:i:s'),
                'user_name'=>$user['real_name'],
                'effect_date'=>$user['re_entry_date']
        );
        foreach($role as $ro=>$va){
            $result = array();
            if('hr' == $ro && intval($params['submit']) != 3){
                $result['flow_stage'] = Const_Flow::FLOW_ENTRY_3;//第3阶段，hr确认
                $result['role_type'] = Const_Flow::ROLE_HR;//hr
                if(intval($params['submit']) == 1){//确认入职
                    $result['flow_opt'] = Const_Flow::PHASE_4;//确认入职
                    //更新flow的生效时间
                    $data_flow = array('effect_date'=>$user['re_entry_date']);
                    $this->_get_bll_flow_info()->update_flow_entry($flow['flow_id'],$data_flow);
                    //更新log的生效时间
                    $this->_get_bll_flow_log()->update_plan_date($flow['flow_id'],$user['re_entry_date']);
                }else{
                    $result['flow_opt'] = Const_Flow::PHASE_5;//取消入职
                }
            }elseif('it' == $ro && intval($params['submit']) == 3){
                $result['flow_stage'] = Const_Flow::FLOW_ENTRY_2;//第2阶段，IT
                $result['role_type'] = Const_Flow::ROLE_IT;//hr
                $result['flow_opt'] = Const_Flow::PHASE_3;//确认入职
                //编辑不需记录log
                if(!$flow['flow_role_list'] || ($flow['flow_role_list'] == Const_Flow::ROLE_ADMIN && is_numeric($flow['flow_role_list']))){
                    $result = array();
                }
            }elseif('xz' == $ro && intval($params['submit']) == 3){
                $result['flow_stage'] = Const_Flow::FLOW_ENTRY_2;//第2阶段，行政
                $result['role_type'] = Const_Flow::ROLE_ADMIN;//hr
                $result['flow_opt'] = Const_Flow::PHASE_2;//确认入职
                //编辑不需记录log
                if(!$flow['flow_role_list'] || ($flow['flow_role_list'] == Const_Flow::ROLE_IT && is_numeric($flow['flow_role_list']))){
                    $result = array();
                }
            }elseif('qx_xz' == $ro && intval($params['submit']) == 3){
                $result['flow_stage'] = Const_Flow::FLOW_ENTRY_4;//第4阶段，行政
                $result['role_type'] = Const_Flow::ROLE_ADMIN;//hr
                $result['flow_opt'] = Const_Flow::PHASE_8;//确认入职
                //编辑不需记录log
                if(!$flow['flow_role_list'] || ($flow['flow_role_list'] == Const_Flow::ROLE_ADMIN && is_numeric($flow['flow_role_list']))){
                    $result = array();
                }
            }elseif('qx_it' == $ro && intval($params['submit']) == 3){
                $result['flow_stage'] = Const_Flow::FLOW_ENTRY_4;//第4阶段，it
                $result['role_type'] = Const_Flow::ROLE_IT;//it
                $result['flow_opt'] = Const_Flow::PHASE_7;//确认入职
                //编辑不需记录log
                if(!$flow['flow_role_list'] || ($flow['flow_role_list'] == Const_Flow::ROLE_IT && is_numeric($flow['flow_role_list']))){
                    $result = array();
                }
            }
            if(!empty($result)){
                $result = array_merge($basic,$result);
                $this->_get_bll_flow_log()->save_log($result);
            }
        }
    }
    /**
     * 做待办事项步骤处理
     */
    private function _execute_stage($role,$params,$user){
        //行政提交
        if(isset($role['xz']) && intval($params['submit']) == 3){
            $flow = $this->_get_bll_flow_info()->get_flow_by_uid($params['entry_id']);
            $this->_execute_stage_xz($flow,$role,$params,$user);
        }
        //IT提交
        if(isset($role['it']) && intval($params['submit']) == 3){
            $flow = $this->_get_bll_flow_info()->get_flow_by_uid($params['entry_id']);
            $this->_execute_stage_it($flow,$role,$params,$user);
        }
        //HR提交
        if(isset($role['hr']) && intval($params['submit']) != 3){
            $flow = $this->_get_bll_flow_info()->get_flow_by_uid($params['entry_id']);
            $this->_execute_stage_hr($flow,$role,$params,$user);
        }
        //取消入职-行政提交
        if(isset($role['qx_xz']) && intval($params['submit']) == 3){
            $flow = $this->_get_bll_flow_info()->get_flow_by_uid($params['entry_id']);
            $this->_execute_stage_qx_xz($flow,$role,$params,$user);
        }
        //取消入职-IT提交
        if(isset($role['qx_it']) && intval($params['submit']) == 3){
            $flow = $this->_get_bll_flow_info()->get_flow_by_uid($params['entry_id']);
            $this->_execute_stage_qx_it($flow,$role,$params,$user);
        }
    }
    /**
     * 取消入职-行政流程阶段处理
     */
    private function _execute_stage_qx_xz($flow,$role,$params,$user){
        $data = array();
        //此为最后操作，
        if($flow['flow_role_list'] == Const_Flow::ROLE_ADMIN && is_numeric($flow['flow_role_list'])){
            $data['flow_role_list'] = '';
            $data['now_status']     = Const_Flow::FLOW_STATUS_CANCEL;
            //设置成最后阶段的最后操作
            $data['flow_stage']     = Const_Flow::FLOW_ENTRY_4;
            $data['flow_opt']     = Const_Flow::PHASE_8;
        }else{//it 还没操作
            $data['flow_role_list'] = Const_Flow::ROLE_IT;
            $data['flow_opt']     = Const_Flow::PHASE_8;
            $data['flow_stage']     = Const_Flow::FLOW_ENTRY_3;
        }
       $this->_get_bll_flow_info()->update_flow_entry($flow['flow_id'],$data);
    }
    /**
     * 取消入职-it流程阶段处理
     */
    private function _execute_stage_qx_it($flow,$role,$params,$user){
        $data = array();
        //此为最后操作，
        if($flow['flow_role_list'] == Const_Flow::ROLE_IT && is_numeric($flow['flow_role_list'])){
            $data['flow_role_list'] = '';
            $data['now_status']     = Const_Flow::FLOW_STATUS_CANCEL;
            //设置成最后阶段的最后操作
            $data['flow_stage']     = Const_Flow::FLOW_ENTRY_4;
            $data['flow_opt']     = Const_Flow::PHASE_7;
        }else{//xz 还没操作
            $data['flow_role_list'] = Const_Flow::ROLE_ADMIN;
            $data['flow_opt']     = Const_Flow::PHASE_7;
            $data['flow_stage']     = Const_Flow::FLOW_ENTRY_3;
        }
        $this->_get_bll_flow_info()->update_flow_entry($flow['flow_id'],$data);
    }
    /**
     * 行政流程阶段处理
     */
    private function _execute_stage_xz($flow,$role,$params,$user){
        $data = array();
        if($user['user_id']){//hr已经确认入职
            //此为最后操作，
            if($flow['flow_role_list'] == Const_Flow::ROLE_ADMIN && is_numeric($flow['flow_role_list'])){
                $data['flow_role_list'] = '';
                $data['now_status']     = Const_Flow::FLOW_STATUS_EFFECT;
                //设置成最后阶段的最后操作
                $data['flow_stage']     = Const_Flow::FLOW_ENTRY_3;
                $data['flow_opt']     = Const_Flow::PHASE_4;
            }else{//it 还没操作
                $data['flow_role_list'] = Const_Flow::ROLE_IT;
                $data['flow_opt']     = Const_Flow::PHASE_2;
                $data['flow_stage']     = Const_Flow::FLOW_ENTRY_1;
            }
            $this->_get_bll_flow_info()->update_flow_entry($flow['flow_id'],$data);
        }else{//hr没有操作
            $data['flow_type'] = Const_Flow::FLOW_TYPE_ENTRY;
            $data['flow_stage'] = Const_Flow::FLOW_ENTRY_2;
            $data['flow_opt'] = Const_Flow::PHASE_2;
            $this->_get_bll_flow_info()->update_flow($flow['flow_id'],$data);
        }
    }
    /**
     * IT流程阶段处理
     */
    private function _execute_stage_it($flow,$role,$params,$user){
        $data = array();
        if($user['user_id']){//hr已经确认入职
            //此为最后操作，
            if($flow['flow_role_list'] == Const_Flow::ROLE_IT && is_numeric($flow['flow_role_list'])){
                $data['flow_role_list'] = '';
                $data['now_status']     = Const_Flow::FLOW_STATUS_EFFECT;
                //设置成最后阶段的最后操作
                $data['flow_stage']     = Const_Flow::FLOW_ENTRY_3;
                $data['flow_opt']     = Const_Flow::PHASE_4;
            }else{//行政还没操作
                $data['flow_role_list'] = Const_Flow::ROLE_ADMIN;
                $data['flow_opt']     = Const_Flow::PHASE_3;
                $data['flow_stage']     = Const_Flow::FLOW_ENTRY_1;
            }
            $this->_get_bll_flow_info()->update_flow_entry($flow['flow_id'],$data);
        }else{//hr没有操作
            $data['flow_type'] = Const_Flow::FLOW_TYPE_ENTRY;
            $data['flow_stage'] = Const_Flow::FLOW_ENTRY_2;
            $data['flow_opt'] = Const_Flow::PHASE_3;
            $this->_get_bll_flow_info()->update_flow($flow['flow_id'],$data);
        }
    }
    /**
     * HR流程阶段处理
     */
    private function _execute_stage_hr($flow,$role,$params,$user){
        $data = array();
        if(intval($params['submit']) == Const_Flow::ENTRY_OK){//确认入职
            //正常提交，xz+it->hr
            if($flow['flow_role_list'] == Const_Flow::ROLE_HR){
                $data['flow_role_list'] = '';
                $data['now_status']     = Const_Flow::FLOW_STATUS_EFFECT;
                $data['flow_stage']     = Const_Flow::FLOW_ENTRY_3;
                $data['flow_opt']       = Const_Flow::PHASE_4;
                $this->_get_bll_flow_info()->update_flow_entry($flow['flow_id'],$data);
            }
            //非正常提交,不更新flow
        }elseif(intval($params['submit']) == Const_Flow::ENTRY_CANCEL){//取消入职
            //进入取消入职流程
            $it_operated = $this->_get_bll_flow_log()->get_log_by_id_role($flow['flow_id'], Const_Flow::ROLE_IT, Const_Flow::PHASE_3);
            $xz_operated = $this->_get_bll_flow_log()->get_log_by_id_role($flow['flow_id'], Const_Flow::ROLE_ADMIN, Const_Flow::PHASE_2);
            if($it_operated && $xz_operated){
                $data['flow_role_list'] = Const_Flow::ROLE_ADMIN.",".Const_Flow::ROLE_IT;
            }elseif($it_operated){
                $data['flow_role_list'] = Const_Flow::ROLE_IT."";
            }elseif($xz_operated){
                $data['flow_role_list'] = Const_Flow::ROLE_ADMIN."";
            }else{
                $data['flow_role_list'] = "";
                $data['now_status']     = Const_Flow::FLOW_STATUS_CANCEL;
            }
            //设置成最后阶段的最后操作
            $data['flow_stage']     = Const_Flow::FLOW_ENTRY_3;
            $data['flow_opt']     = Const_Flow::PHASE_5;
            $this->_get_bll_flow_info()->update_flow_entry($flow['flow_id'],$data);
        }
    }
    /**
     * 获取待办事项
     */
    private function _get_flow_by_id($entry_id){
        if(!$this->flow || !isset($this->flow[$entry_id])){
            $this->flow[$entry_id] = $this->_get_bll_flow_info()->get_flow_by_uid($entry_id);
        }
        return $this->flow[$entry_id];
    }
    /**
     * return user_id
     */
    private function _new_hroa_user_and_relation($entry,$hroa){
        //新建user
        $user = $this->_build_entry_to_user($entry);
        $user_id = $hroa->user_insert($user);
        //新建工作关系
        $work = $this->_build_entry_to_work($user_id,$entry);
        $hroa->work_insert($work);
        //新建汇报关系
        $relation = $this->_build_entry_to_relation($user_id,$entry);
        $hroa->relation_insert($relation);

        return $user_id;
    }
    private function _delete_hioa_user_and_relation($entry,$hroa){
        //更新user
        $data = $this->_build_entry_to_user($entry);
        $hroa->user_update($entry['user_id'],$data);
        //取消入职，断开工作关系
        $relation = $this->_build_entry_to_relation($entry['user_id'],$entry);
        $hroa->relation_delete($relation);
        //取消入职，断开汇报关系
        $work = $this->_build_entry_to_work($entry['user_id'],$entry);
        $hroa->work_delete($work);
    }
    /**
     * 构建工作关系
     */
    private function _build_entry_to_work($user_id,$entry){
        $result = array(
                'user_id'=>$user_id,
                'job_id'=>$entry['job_id'],
                'work_time'=>$entry['re_entry_date'],
                'is_parttime'=>Const_BaseInfo::WORK_MAIN,
                'created'=>date('Ymd'),
                'last_update'=>date('Y-m-d H:i:s')
        );
        if($entry['is_entry']!=1){//非确认入职
            $result['is_deleted'] = Const_BaseInfo::IS_DELETE_YES;
        }
        return $result;
    }
    /**
     * 构建汇报关系
     */
    private function _build_entry_to_relation($user_id,$entry){
        $result = array(
                'user_id'=>$user_id,
                'user_job_id'=>$entry['job_id'],
                'parent_id'=>$entry['parent_id'],
                'parent_job_id'=>$entry['parent_job_id'],
                'is_direct'=>Const_BaseInfo::DIRECTOR_IS_DIRECT_YES,
                'created'=>date('Ymd'),
                'last_update'=>date('Y-m-d H:i:s'),
        );
        if($entry['is_entry']!=1){//非确认入职
            $result['is_deleted'] = Const_BaseInfo::IS_DELETE_YES;
        }
        return $result;
    }
    /**
     * 构建用户信息
     */
    private function _build_entry_to_user($entry){
        $result = array(
                'real_name'=>$entry['real_name'],
                'user_name'=>$entry['real_name'],
                'english_name'=>$entry['english_name'],
                'domain_account'=>$entry['domain_account'],
                'crm_account'=>$entry['crm_account'],
                'sex'=>$entry['sex'],
                'cellphone'=>$entry['cellphone'],
                'identity_type'=>$entry['identity_type'],
                'identity_code'=>$entry['identity_code'],
                'enter_date'=>$entry['re_entry_date'],
                'city_id'=>$entry['city_id'],
                'work_city_id'=>$entry['work_city_id'],
                'user_type'=>$entry['user_type'],
                'user_code'=>$entry['user_code'],
                'office_phone'=>$entry['office_phone'],
                'office_phone_ex'=>$entry['office_phone_ex'],
                'office_mail'=>$entry['office_mail'],
                'last_update'=>date('Y-m-d H:i:s'),
                );
        if($entry['is_entry']!=1){//非确认入职
            $result['job_status'] = Const_BaseInfo::USER_WORK_NO;
            $result['leaving_type'] = Const_BaseInfo::USER_LEAVING_TYPE_NO_REPORT;
            $result['leaving_date'] = $entry['re_entry_date'];
            $result['last_date']= $entry['re_entry_date'];
        }
        $entry_extend = $this->_get_lumesse_entry_extend($entry['entry_id']);
        $result = array_merge($result,$entry_extend);
        return $result;
    }
    /**
     * 招聘系统同步的扩展数据
     */
    private function _get_lumesse_entry_extend($entry_id){
        $result = array();
        $dao_entry_extend = $this->_get_dao_entry_extend();
        $res = $dao_entry_extend->find_by_id($entry_id);
        if($res && isset($res['entry_id'])){
            unset($res['id']);
            unset($res['entry_id']);
            unset($res['lums_application_id']);
            $result = $res;
        }
        return $result;
    }
    /**
     * 获取新的员工职位信息
     */
    public function get_job_by_uids($uids){
        $data = array();
        if(empty($uids)){
            return $data;
        }
        $userlist = $this->_get_dao_flow_user()->find_by_ids($uids);
        if(empty($userlist)){
            return $data;
        }
        $tmp_jobids = array();
        foreach($userlist as $val){
            $tmp_jobids[$val['entry_id']]=$val['job_id'];
        }
        $jobids = array_values($tmp_jobids);
        $bll = new Bll_Hr_OutInterface();
        $job_list = $bll->get_job_dep_infos($jobids);
        $user_data = array();

        foreach($userlist as $val){
            $jobid = $tmp_jobids[$val['entry_id']];
            $user_data[$val['entry_id']]=array(
                    'user_id'=> $val['entry_id'],
                    'name' => $val['real_name'],
                    'code' => $val['user_code'],
                    'job_name' => $job_list[$jobid]['position_name'],
                    'department_id' => $job_list[$jobid]['department_id'],
                    'department_name' => $job_list[$jobid]['bu_name'].$job_list[$jobid]['department_name'],
                    'city_name'=>$job_list[$jobid]['city_name'],
                    'is_entry'=> $val['is_entry'],
                    );
        }
        return $user_data;
    }
    /**
     * 所有入职未分配系统帐号的用户
     */
    public function _get_entrys_now($city_ids,$param){
        $where = array();
        $where['flow_type'] = Const_Flow::FLOW_TYPE_ENTRY;
        $where['now_status']= Const_Flow::FLOW_STATUS_DOING;
        $field =  array('user_id');
        $user_ids_tmp = $this->_get_bll_flow_info()->get_dao("Dao_Flow_Flow")->find_short($where, null,0,0,$field);
        $user_ids = array();
        foreach($user_ids_tmp as $user){
            $user_ids[] = $user['user_id'];
        }
        $where = array();
        if( count($city_ids) < 5 ){
            $where["work_city_id in(".join(',',$city_ids).") AND 1=?"]= 1;
        }
        $where['entry_id in('.join(',',$user_ids).') AND 1=?'] = 1;//1-确认入职，2-取消入职,0-流程进行中
        if(isset($param['start']) && isset($param['end'])){
            $where['entry_date <='.intval(date('Ymd',strtotime($param['end']))).' AND 1=?']= 1;
            $where['entry_date >='.intval(date('Ymd',strtotime($param['start']))).' AND 1=?']= 1;
        }
        //$where['domain_account']= '';
        //$where['crm_account']= '';
        //$where['office_mail']= '';
        $fields =  array('entry_id','real_name','english_name','work_city_id','job_id','user_code','domain_account','crm_account','office_mail');
        return $this->_get_dao_flow_user()->find_short($where, null,0,0,$fields);
    }
    /**
     * 按搜索得到新入职员工数据
     */
    public function get_user_by_where($where){
        return $this->_get_dao_flow_user()->find($where,'',0);
    }
    /**
     * 所有入职未分配系统帐号的用户
     */
    public function get_all_mail_account(){
        $where = array();
        $where['is_entry']= 0;
        $fields =  array('domain_account','crm_account','office_mail');
        return $this->_get_dao_flow_user()->find_short($where, null,0,0,$fields);
    }
    /**
     * 员工入职记录
     * @return Dao_Flow_Entry
     */
    private function _get_dao_flow_user(){
        return $this->get_dao('Dao_Flow_Entry');
    }
    /**
     * 员工入职记录扩展表
     * @return dao
     */
    private function _get_dao_entry_extend(){
        return $this->get_dao('Dao_Flow_EntryExtend');
    }
    /**
     * 待办事项bll
     * @return Bll_Flow_Info
     */
    private function _get_bll_flow_info(){
        if(!$this->bll_flow_info ){
            apf_require_class('Bll_Flow_Info');
            $this->bll_flow_info = new Bll_Flow_Info();
        }
        return $this->bll_flow_info;
    }
    /**
     * 操作日志
     * @return Bll_Flow_OperateLog
     */
    private function _get_bll_flow_log(){
        if(!$this->bll_flow_log ){
            apf_require_class('Bll_Flow_OperateLog');
            $this->bll_flow_log = Bll_Flow_OperateLog::get_instance();
        }
        return $this->bll_flow_log;
    }
    /**
     * hroa interface bll
     * @return Bll_Hr_OutInterface
     */
    private function _get_bll_hroa(){
        if(!$this->bll_hroa ){
            apf_require_class('Bll_Hr_OutInterface');
            $this->bll_hroa = new Bll_Hr_OutInterface();
        }
        return $this->bll_hroa;
    }
}
